<div style="margin:4px;font-weight:bold">PDF Batch Import</div>
<form id="batchimportform2" action="batch_noflash.php" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="commence" value="1">
    <input type="hidden" name="user" value="<?php print htmlspecialchars($_SESSION['user']); ?>">
    <input type="hidden" name="userID" value="<?php print  htmlspecialchars($_SESSION['user_id']); ?>">
    <input type="hidden" name="proxy_name" value="<?php print  htmlspecialchars($proxy_name); ?>">
    <input type="hidden" name="proxy_port" value="<?php print  htmlspecialchars($proxy_port); ?>">
    <input type="hidden" name="proxy_username" value="<?php print  htmlspecialchars($proxy_username); ?>">
    <input type="hidden" name="proxy_password" value="<?php print  htmlspecialchars($proxy_password); ?>">
    <table cellspacing="0" style="width: 100%;border-top: solid 1px #D5D6D9">
        <tr>
            <td valign="top" class="threedright" colspan="2">
                <div id="uploaderOverlay" style="position:absolute; z-index:2"></div>
                <div style="float:left"><input id="select-button" type="file" multiple="multiple" 
                value="Select Files" name="files[]" onChange="makeFileList();" />
            	</div><div style="padding:5px">
                You selected <span id="file-count">0 files</span>.
                (Note that PDFs must contain a <a href="http://en.wikipedia.org/wiki/Digital_object_identifier" target="_blank">DOI</a> in order to track the corresponding metadata.)
           	</div>
            </td>
        </tr>
        <tr>
            <td valign="top" class="threedleft">
                <button id="import-button2" disabled>Import</button>
            </td>
            <td valign="top" class="threedright">
                <table cellspacing=0>
                    <tr>
                        <td class="select_span" style="line-height:22px;width:10em">
                            <input type="checkbox" checked class="uploadcheckbox" style="display:none" name="shelf">
                            <span class="ui-icon ui-icon-check" style="float:left;margin-top: 2px">
                            </span>Add to Shelf
                        </td>
                        <td class="select_span" style="line-height:22px;width: 10em;text-align:right">
                            <input type="checkbox" class="uploadcheckbox" style="display:none" name="project">
                            <div style="float:right">Add&nbsp;to&nbsp;Project&nbsp;</div>
                            <span class="ui-icon ui-icon-close" style="float:right;margin-top: 2px">
                            </span>
                        </td>
                        <td style="line-height:22px;width: 18em">
                            <select name="projectID" style="width:200px">
                                   <?php
				                    foreach($projects as $project) {
				                        print '<option value="'.$project->getId().'">'.htmlspecialchars($project->getProject()).'</option>'.PHP_EOL;
				                    }
				                    ?>
                            </select>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <table cellspacing="0" style="width: 100%" id="table1">
        <tr><td class="threedleft">Select database:</td>
            <td class="threedright">
                <table cellspacing="0">
                    <tr>
                        <td class="select_span">
                        	<input type="checkbox" checked class="uploadcheckbox" style="display:none" name="database[]" value="ieee">
                        	<span class="ui-icon ui-icon-check" style="float:left;margin-top: 2px">
                        	</span>IEEE (Computer science
                       </td>
                     </tr>
                     <tr>
                        <td class="select_span">
                        	<input type="checkbox" checked class="uploadcheckbox" style="display:none" name="database[]" value="acm">
                        	<span class="ui-icon ui-icon-check" style="float:left;margin-top: 2px">
                        	</span>ACM (Computer Science)
                       </td>
                     </tr>
                     <tr>
                     <tr>
                        <td class="select_span">
                        	<input type="checkbox" class="uploadcheckbox" style="display:none" name="database[]" value="springerlink">
                        	<span class="ui-icon ui-icon-close" style="float:left;margin-top: 2px">
                        	</span>Springerlink (Not recomended, very slow)
                       </td>
                     </tr>
                     <tr>
                        <td class="select_span">
                        	<input type="checkbox" class="uploadcheckbox" style="display:none" name="database[]" value="pubmed">
                        	<span class="ui-icon ui-icon-close" style="float:left;margin-top: 2px">
                        	</span>PubMed (biomedicine)
                       </td>
                     </tr>
                     <tr>
                        <td class="select_span">
                        	<input type="checkbox" class="uploadcheckbox" style="display:none" name="database[]" value = "nasa">
                        	<span class="ui-icon ui-icon-close" style="float:left;margin-top: 2px">
                        	</span>NASA ADS (physics, astronomy)
                       </td>
                     </tr>
                        <td class="select_span">
                        	<input type="checkbox" class="uploadcheckbox" style="display:none" name="database[]" value = "crossref">
                        	<span class="ui-icon ui-icon-close" style="float:left;margin-top: 2px">
                        	</span>CrossRef (other sciences)
                       </td>
                     </tr>
                     
                </table>
            </td></tr>
        <tr><td class="threedleft">If metadata not found:</td>
            <td class="threedright" style="line-height: 16px">
                <table cellspacing="0">
                    <tr>
                        <td class="select_span" style="line-height: 16px">
                            <input type="radio" name="failed" value="1" style="display: none" <?php print (isset($batchimport_failed) && $batchimport_failed=='1') ? 'checked' : '' ?>>
                            <span class="ui-icon ui-icon-radio-<?php print (isset($batchimport_failed) && $batchimport_failed=='1') ? 'off' : 'on' ?>" style="float:left"></span>
                            Import the PDF with the data extracted from the PDF. All PDF files will be recorded and indexed!
                        </td></tr>
                    <tr>
                        <td class="select_span" style="line-height: 16px">
                            <input type="radio" name="failed" value="2" style="display: none" <?php print (empty($batchimport_failed) || (isset($batchimport_failed) && $batchimport_failed=='2')) ? 'checked' : '' ?>>
                            <span class="ui-icon ui-icon-radio-<?php print (empty($batchimport_failed) || (isset($batchimport_failed) && $batchimport_failed=='2')) ? 'off' : 'on' ?>" style="float:left"></span>
                            Do not record the PDF, but copy it to<br>&nbsp;&nbsp;&nbsp;&nbsp; <?php print $path.'batch'; ?>
                        </td>
                    </tr>
                    <tr>
                        <td class="select_span" style="line-height: 16px">
                            <input type="radio" name="failed" value="3" style="display: none" <?php print (isset($batchimport_failed) && $batchimport_failed=='3') ? 'checked' : '' ?>>
                            <span class="ui-icon ui-icon-radio-<?php print (isset($batchimport_failed) && $batchimport_failed=='3') ? 'off' : 'on' ?>" style="float:left"></span>
                            Do not record the PDF, do not copy it.
                        </td>
                    </tr></table>
            </td>
        </tr></table>
    <table cellspacing="0" style="width:100%" id="table2">
        <tr>
            <td class="threedleft">
                Choose&nbsp;category:<br>
            </td>
            <td class="threedright">
                <div id="categorydiv" style="width: 99%;overflow:scroll; height: 310px;background-color: white;color: black;border: 1px solid #C5C6C9">
                    <table cellspacing=0 style="float:left;width: 49%">
                          <?php
	

							$i=1;
							$isdiv = null;
							foreach ($allCategories as $cat){
								if ($i > (1+$numberOfCategories['num']/2) && !$isdiv) {
									print '</table><table cellspacing=0 style="width: 49%;float: right;padding:2px">';
									$isdiv = true;
								}
								
								print PHP_EOL.'<tr><td class="select_span">';
								print "<input type=\"checkbox\" name=\"category[]\" value=\"".htmlspecialchars($cat->getId())."\"";
								print " style=\"display:none\"><span class=\"ui-icon ui-icon-close\" style=\"float:left\"></span>".htmlspecialchars($cat->getCategory())."</td></tr>";
								$i=$i+1;
							}
							
							?>
                    </table>
                </div>
                <span class="ui-icon ui-icon-triangle-1-s" style="cursor: pointer;float:left" id="enlargelist"></span>
                <span class="ui-icon ui-icon-triangle-1-n" style="cursor: pointer;" id="shrinklist"></span>
            </td>
        </tr>
        <tr>
            <td class="threedleft">
                Add to new categories:
            </td>
            <td class="threedright">
                <input type="text" size="30" name="category2[]" value=""><br>
                <input type="text" size="30" name="category2[]" value=""><br>
                <input type="text" size="30" name="category2[]" value="">
            </td>
        </tr>
    </table>
</form>
<br>